package Data::Conveyor::Transaction::Factory;

# $Id: Factory.pm 11482 2006-05-22 20:55:19Z gr $

use strict;
use warnings;
use Error::Hierarchy::Util 'assert_defined';


our $VERSION = '0.02';


use base 'Class::Scaffold::Factory';


# Subclasses have to override - and therefore define - the mappings of object
# types and commands to transaction handler classes.

# For the txsel, it's ok if there is no handler for a given situation, so just
# map to Class::Null

use constant TXSEL_CLASS_FOR_TRANSACTION => (
    _AUTO => 'Class::Null',
);


sub gen_txsel_handler {
    my ($self, $object_type, $command, $context, %args) = @_;

    # object_type and command can be normal strings, shouldn't enforce
    # assert_object_type().

    assert_defined $object_type, 'called without object_type';
    assert_defined $command,     'called without command';
    assert_defined $context,     'called without context';

    $self->gen_handler(TXSEL_CLASS_FOR_TRANSACTION =>
        [ $object_type, $command, $context ], %args);
}


1;


__END__

{% USE p = PodGenerated %}

=head1 NAME

{% p.package %} - stage-based conveyor-belt-like ticket handling system

=head1 SYNOPSIS

    {% p.package %}->new;

=head1 DESCRIPTION

None yet. This is an early release; fully functional, but undocumented. The
next release will have more documentation.

=head1 METHODS

=over 4

{% p.write_methods %}

=back

{% p.write_inheritance %}

{% PROCESS standard_pod %}

=cut

